import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/admin/param/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/admin/param',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/admin/param/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/admin/param/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/admin/param',
    method: 'put',
    data: obj
  })
}

export function getInfoLink(publicKey,linkType) {
  return request({
    url: '/admin/param/getInfo/' + publicKey +'/'+linkType,
    method: 'get'
  })
}

export function getShowFlag(publicKey,linkType,linkId) {
  return request({
    url: '/admin/param/getShowFlag/' + publicKey +'/'+linkType +'/' +linkId,
    method: 'get'
  })
}

export function getInfoParam(publicKey,linkType,linkId) {
  return request({
    url: '/admin/param/getInfoParam/' + publicKey +'/'+linkType +'/' +linkId,
    method: 'get'
  })
}

export function getInfoByPublicKey(publicKey) {
  return request({
    url: '/admin/param/getInfoByPublicKey/' + publicKey,
    method: 'get'
  })
}

export function getInfoByKeyAndUnitId(publicKey,unitId) {
  return request({
    url: '/admin/param/publicValue/' + publicKey +'/'+unitId,
    method: 'get'
  })
}